//引入api
import { reqCategoryList, mockreqBannerList, mockreqFloorList } from '@/api'

//home模块的小仓库
const actions = {
    async categoryList({ commit }) {
        const categoryLists = await reqCategoryList();
        commit("CATEGORYLIST", categoryLists.data)
    },
    async getBannerList({ commit }) {
        const bannerList = await mockreqBannerList();
        commit("GETBANNERLIST", bannerList.data)
    },
    async getFloorList({ commit }) {
        const floorList = await mockreqFloorList();
        commit("GETFLOORLIST", floorList.data)
    }
};

const mutations = {
    CATEGORYLIST(state, value) {
        state.categoryLists = value
    },
    GETBANNERLIST(state, value) {
        state.bannerList = value
    },
    GETFLOORLIST(state, value) {
        state.floorList = value
    }
}

const state = {
    categoryLists: [],
    bannerList: [],
    floorList: []
}

const getters = {}

export default {
    actions,
    mutations,
    state,
    getters
}